package cj.web.login.controllers;

import java.util.List;
import java.util.Map;

import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.annotation.rest.Post;
import net.paoding.rose.web.var.Model;
import net.sf.json.JSONObject;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import cj.web.admin.dao.SurveyDAO;
import cj.web.admin.dao.SurveyPeopleDAO;
import cj.web.admin.domain.Survey;
import cj.web.admin.domain.SurveyPeople;

@Path("/position")
public class PositionController extends BaseController{

	private static Logger logger = Logger.getLogger(PositionController.class.getName());
	
	@Autowired
	private SurveyDAO surveyDao;
	@Autowired
	private SurveyPeopleDAO SurveyPeopleDao;
	
	@Get("show")
	public String show(Model model,SurveyPeople surveyPeople) {
	
		List<Survey> surveylis = surveyDao.queryAll();
		//MemuEnum
        model.add("surveylis",surveylis);
		return "/views/survey/surveyDiffList.vm";
	}

	@Post("getList")
	public String queryList(SurveyPeople surveyPeople) {
		JSONObject jo = new JSONObject();
		List<Map> arr = SurveyPeopleDao.queryDiff(surveyPeople.getSurveyId());
		jo.put("data", arr);
		jo.put("draw", surveyPeople.getDraw());
		return "@" + jo.toString();
	}
}